﻿using System;

namespace KelionesLapai
{
    internal class Data
    {
        private readonly double _litersCoef; // Koeficientas
        private readonly int _sp_end; // Pabaigos parodymai
        private readonly int _sp_start; // Pradzios parodymai
        private int _boughtLiters; // Nupirkta šį kartą litrų
        private int _startLiters; // Pradėta su litrais

        public Data(int spEnd, int spStart, double litersCoef, int boughtLiters, int lastLiters)
        {
            _sp_end = spEnd;
            _sp_start = spStart;
            _litersCoef = litersCoef;
            _boughtLiters = boughtLiters;
            _startLiters = lastLiters;
        }

        public int Driven
        {
            get { return _sp_end - _sp_start; }
        }

        private int LitersUsed
        {
            get { return getRounding(Driven*_litersCoef, 0); }
        }

        public int getRounding(double number, int decimalPoints)
        {
            double decimalPowerOfTen = Math.Pow(10, decimalPoints);
            return Convert.ToInt32(Math.Floor(number*decimalPowerOfTen + 0.6)/decimalPowerOfTen);
        }
    }
}